package user;

import operation.*;

import java.util.Scanner;

// 继承Man类，以此来实现 通过接口数组 对功能分类
public class Buyman extends Man {
    private String account;
    private String password;
    private String sex;
    private int age;
    private int point;

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }
    private static int count = 1;
    public Buyman(String name) {
        super(name);
        this.ioPerations = new IOPeration[]{
                new ExitSystem(),
                new FindMedicine(),
                new FindEquipment(),
                new BorrowEquipment(),
                new BuyMedicine(),
                new ReturnEquipment(),
                new FindPoint(),
                new ChangeBuyPassword()
        };
    }

    @Override
    public int menu() {
        if(count == 1){
            System.out.println("欢迎 "+this.name+" 进入药店！");
            count++;
        }
        System.out.println("*********购买者操作面板***********");
        System.out.println("1.查找药品");
        System.out.println("2.查找器械");
        System.out.println("3.租用医疗器械");
        System.out.println("4.购买药品");
        System.out.println("5.归还医疗器械");
        System.out.println("6.查询积分");
        System.out.println("7.修改密码");
        System.out.println("0.退出系统");
        System.out.println("**************************");
        System.out.println("请输入你的操作");
        Scanner sc = new Scanner(System.in);
        int choice = -1;
        try{
            choice = sc.nextInt();
        }catch (Exception e){
            //System.out.println("操作存在错误！！！");
        }
        return choice;
    }
}
